package de.keychain

import grails.transaction.Transactional

import org.codehaus.groovy.grails.plugins.codecs.SHA256Codec

@Transactional
class LoginService {

    def login(String username, String password) {

		def configuration = Configuration.first()
		
		password = SHA256Codec.encode(password)
		
		return configuration?.service?.username == username && configuration.service.passwords?.grep({it.password == password && it.enabled}).size() >0
    }
}
